import Vue from 'vue';

import VueRouter from 'vue-router';

Vue.use(VueRouter);

import UserLogin from '../pages/UserLogin';

import UserRegister from '../pages/UserRegister';

import UserHome from '../pages/UserHome';

import HomePage from '../pages/UserHome/HomePage';

import UserBill from '../pages/UserHome/UserBill';

import UserCount from '../pages/UserHome/UserCount';

import UserInfo from '../pages/UserHome/UserInfo';

import UserAdd from '../pages/UserAdd';

import UserPay from '../pages/UserAdd/UserPay';

import UserGet from '../pages/UserAdd/UserGet';

import SetUser from '../pages/SetUser';

export default new VueRouter({
    routes: [{
            name: 'userLogin',
            path: '/userLogin',
            component: UserLogin,
            meta: {
                beforeLogin: true,
            }
        },
        {
            name: 'userRegister',
            path: '/userRegister',
            component: UserRegister,
            meta: {
                beforeLogin: true,
            }
        },
        {
            name: 'userHome',
            path: '/userHome',
            component: UserHome,
            children: [{
                    name: 'homePage',
                    path: 'homePage',
                    component: HomePage,
                },
                {
                    name: 'userBill',
                    path: 'userBill',
                    component: UserBill,
                },
                {
                    name: 'userCount',
                    path: 'userCount',
                    component: UserCount,
                },
                {
                    name: 'userInfo',
                    path: 'userInfo',
                    component: UserInfo,
                }
            ]

        },
        {
            name: 'userAdd',
            path: '/userAdd',
            component: UserAdd,
            children: [{
                    name: 'userPay',
                    path: 'userPay',
                    component: UserPay,
                },
                {
                    name: 'userGet',
                    path: 'userGet',
                    component: UserGet,
                }
            ]
        },
        {
            name: 'setUser',
            path: '/setUser',
            component: SetUser,
        },
        {
            path: '*',
            redirect: '/userLogin',
        }
    ]
})